package com.anplurk.model;

import org.json.JSONException;
import org.json.JSONObject;

public class PlurkResponseModel {

    String plurkId;
    String id;
    UserModel owner;
    String qualifier;
    String content;
    String contentRaw;
    
    public String toString(){       
        return "plurkId=" + plurkId +  ", owner=" + owner  + ",id=" + id + ", qualifier=" +qualifier + ", content=" + content + ",contentRaw=" + contentRaw;        
    }
    
    
    public static PlurkResponseModel newInstance(JSONObject obj) throws JSONException {
        PlurkResponseModel plurkResponse = new PlurkResponseModel();
        plurkResponse.setPlurkId(obj.getString("plurk_id"));
        plurkResponse.setId(obj.getString("id"));
        plurkResponse.setContent(obj.getString("content"));
        plurkResponse.setQualifier(obj.getString("qualifier"));        
        plurkResponse.setContentRaw(obj.getString("content_raw"));
        
        return plurkResponse;
    }
    
    public String getPlurkId() {
        return plurkId;
    }
    public UserModel getOwner() {
        return owner;
    }
    public String getQualifier() {
        return qualifier;
    }
    public String getContent() {
        return content;
    }
    public void setPlurkId(String plurkId) {
        this.plurkId = plurkId;
    }
    public void setOwner(UserModel owner) {
        this.owner = owner;
    }
    public void setQualifier(String qualifier) {
        this.qualifier = PlurkModel.QUALIFIER_DEFAULT;
        for (String q : PlurkModel.QUALIFIERS) { 
            if (q.equalsIgnoreCase(qualifier)) {
                this.qualifier = qualifier;
                break;
            }            
        }       
    }
    public void setContent(String content) {
        this.content = content;
    }


    public String getContentRaw() {
        return contentRaw;
    }


    public void setContentRaw(String contentRaw) {
        this.contentRaw = contentRaw;
    }


    public String getId() {
        return id;
    }


    public void setId(String id) {
        this.id = id;
    }

}
